Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue1100 #1320

Merged
merged 4 commits into from
Nov 21, 2016
Merged

issue1100 #1320

merged 4 commits into from
Nov 21, 2016

Conversation

lc-thomasberger
Copy link
Member

Update blockView to add css class if element is onScreen.

Block config:

{
        "_id": "b-05",
        "_parentId": "a-05",
        "_type": "block",
        "_classes": "animated",
        "title": "b-05",
        "displayTitle": "",
        "body": "",
        "_trackingId": 0,
        "_onScreen": {
            "_isEnabled": true,
            "_classes": "wobble",
            "_percentInviewVertical": 50  // defaults to 33%
        }
    }

Disabled by default.
The block config shows example using animate.css animtions.

Block config:
```
{
        "_id": "b-05",
        "_parentId": "a-05",
        "_type": "block",
        "_classes": "animated",
        "title": "b-05",
        "displayTitle": "",
        "body": "",
        "_trackingId": 0,
        "_onScreen": {
            "_isEnabled": true,
            "_classes": "wobble",
            "_percentInviewVertical": 50
        }
    }
```
Disabled by default.
setupOnScreenHandler: function() {
var onscreen = this.model.get('_onScreen');

if (onscreen && onscreen._isEnabled) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind terribly reversing the logic here so we can sink the indentation?

if (!onscreen || !onscreen._isEnabled) return;

Copy link
Member

@oliverfoster oliverfoster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm worried the off("onscreen") will break anything else that is listening, i suggest we namespace the event with onscreen.adaptView


if (!onscreen || !onscreen._isEnabled) return;

this.$el.on('onscreen', _.bind(function (e, m) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you change this to this.$el('onscreen.adaptView'?


if (m.percentInviewVertical < minVerticalInview) return;

this.$el.addClass( onscreen._classes || 'onscreen' ).off('onscreen');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you change this to .off('onscreen.adaptView');?

@@ -93,6 +112,7 @@ define([
},

remove: function() {
this.$el.off('onscreen');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you change this to .off('onscreen.adaptView')?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants